<?php

namespace Modules\Edu\Transformers;

use Illuminate\Http\Resources\Json\JsonResource;

use App\Http\Resources\UserResource;

class CommentResource extends JsonResource
{

    public function toArray($request)
    {
        $comment = parent::toArray($request);
        $comment['user'] = new UserResource($this->user);
        $comment['html'] = $this->html;
        $comment['reply_user'] = new UserResource($this->replyUser);
        $comment['created_at'] = $this->created_at->diffForHumans();
        return $comment;

    }
}
